/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function postPriceAunction() {
    $.ajax({type: 'POST', url: '/product/auction', data: $("#auction_form").serialize(), success: function(response) {

            $("#price_notice").html(response);
        }});
    return false;
}

function postComment() {
    $.ajax({type: 'POST', url: '/product/comment', data: $("#comment_form").serialize(), success: function(response) {

            $("#comment_notice").html(response);
        }});
    return false;
}

$(document).ready(function() {
    // alert("Ready");
    function loading_show() {
        $('#loading').html("<img src='/public/images/loading.gif'/>").fadeIn('fast');
    }
    function loading_hide() {
        $('#loading').fadeOut('fast');
    }
    function loadData(page) {
        // loading_show();
        var idProduct = $("#idProduct").val();
        $.ajax
                ({
                    type: "POST",
                    url: "/product/pagingComment/",
                    data: "page=" + page + "&idProduct=" + idProduct,
                    success: function(msg)
                    {
                        $("#show_comment").ajaxComplete(function(event, request, settings)
                        {
                            //loading_hide();
                            $("#show_comment").html(msg);
                            //alert("Some things");
                     });
                    }
                });
    }
    loadData(1);  // For first time page load default results
    $('#show_comment .pagination li.active').live('click', function() {
        var page = $(this).attr('p');
        loadData(page);
    });
});